﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SafeHomeSystem
{
    public partial class Monitor_ControlPanel : Form
    {
        public int n = 0;
        public Monitor_ControlPanel()
        {
            InitializeComponent();
        }

        private void pwd_Click(object sender, EventArgs e)
        {

        }
        private bool check()
        {
            if (this.text_pwd.Text == "123" && this.text_user.Text == "test")
                return true;
            else
                return false;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (!check())
            {
                MessageBox.Show("用户名或密码错误，请重新输入！", "错误");
                n++;
                label3.Visible = true;
                label3.Text = "（您还有 " + (3 - n) + " 次机会）";
                if (n == 3)
                {
                    MessageBox.Show("您已经连续3次输入错误，系统关闭！", "错误");
                    this.Close();
                }
            }
            else {
                Monitor_Camera mainc = new Monitor_Camera();
                mainc.Show();
                this.Close();
            }
        }
    }
}
